using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace SimpleCounter
{
    public partial class FMain : Form
    {
        HardwareSoftwareInterface oInterface = new HardwareSoftwareInterface();

        public FMain()
        {
            InitializeComponent();            
        }

        private void FMain_Load(object sender, EventArgs e)
        {
            oInterface.LoadHardware();
            oInterface.SetEnable(false);
            oInterface.Reset();
            lblCount.Text = oInterface.ReadCounter().ToString();
        }

        private void cmdStep_Click(object sender, EventArgs e)
        {
            oInterface.StepClock();
            lblCount.Text = oInterface.ReadCounter().ToString();
        }

        private void cmdReset_Click(object sender, EventArgs e)
        {
            oInterface.Reset();
            lblCount.Text = oInterface.ReadCounter().ToString();
        }

        private void cmdGUI_Click(object sender, EventArgs e)
        {
            oInterface.ViewHardware();
        }

        private void cbEnabled_CheckedChanged(object sender, EventArgs e)
        {
            if (cbEnabled.Checked)
                oInterface.SetEnable(true);
            else
                oInterface.SetEnable(false);
        }
    }
}